#include "Comm.hpp"

int main()
{
    NamedPipe::CreatePipe();
    int fd = open(pathName, O_RDONLY);
    if(fd < 0)
    {
        std::cout << "server open error\n";
    }
    char buff[1024];
    while(true)
    {
        ssize_t n = ::read(fd, buff, sizeof(buff) - 1);
        if(n > 0)
        {
            buff[n] = 0;
            std::cout << "client say#" << buff << std::endl;
        }
        else if(n == 0)
        {
            std::cout << "client quit, me too\n";
            break;
        }
        else
        {
            std::cout << "read error\n";
            break;
        }
    }
    return 0;
}